﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using AllenalaMente.State;
using System.Collections.ObjectModel;

namespace AllenalaMente.Menu
{
    public class AchsVoice
    {
        public string name { get; set; }
        public string description { get; set; }
        public string imagePath { get; set; }
    }

    public partial class AchievementsMenu : PhoneApplicationPage
    {
        private GameState gameState;

        public AchievementsMenu()
        {
            InitializeComponent();

            PageTitle.Text = Locale.Strings.Achievements;

            gameState = GameStateManager.GetState();

            // Elenco Achievements
            var Achs = new ObservableCollection<AchsVoice>();   
        
            Random rnd = new Random();

            for (int i = 0; i < 20; i++)
            {
                int r = rnd.Next(1, 8);
                string path = "/AllenalaMente;component/Assets/Images/Items/Item0" + r + ".png";

                Achs.Add(new AchsVoice() { name = "Target " + (i + 1), imagePath = path, description = "Ottieni il miglior risulato bla bla bla" });
            }

            listBoxAchievements.ItemsSource = Achs;

            Animation.FadeIn(this, 500);
        }

        private void buttonConfirm_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/AllenalaMente;component/MainPage.xaml", UriKind.RelativeOrAbsolute));
        }

        private void listBoxAchievements_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox list = sender as ListBox;
            AchsVoice item = list.SelectedItem as AchsVoice;
            System.Diagnostics.Debug.WriteLine(item.name);
        }
    }
}